﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ApiGateway.Auth.Dto;
using Gmmy.Utility;
using Surging.Core.CPlatform.Ioc;

namespace ApiGateway.Auth.Services
{
    public interface IAuthService : IServiceKey
    {
        /// <summary>
        /// 登录授权
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<CustomApiResult> Authentication(LoginDto input);

        /// <summary>
        /// token授权校验
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<CustomApiResult> AuthorizationCheck(UserCheckDto input);

        /// <summary>
        /// 获取登陆者信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<CustomApiResult> Info(AuthToken input);
        /// <summary>
        /// 获取登陆者信息(jwt)
        /// </summary>
        /// <param name="token"></param>
        /// <returns></returns>
        Task<(bool isSuccess, dynamic userInfo)> GetTokenInfo(string token);
        /// <summary>
        /// 登出
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<CustomApiResult> Logout(AuthToken input);

        /// <summary>
        /// 更新授权缓存
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<CustomApiResult> UpdateToken(AuthToken input);

        /// <summary>
        /// 刷新缓存
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<CustomApiResult> ReflushAuthToken(AuthToken input);
    }
}
